﻿CREATE TABLE [dbo].[PiStaffOrganize] (
    [Id]           INT            IDENTITY (1, 1) NOT NULL,
    [StaffId]      INT            NULL,
    [OrganizeId]   INT            NOT NULL,
    [Enabled]      INT            CONSTRAINT [DF__PiStaffOr__Enabl__6C190EBB] DEFAULT ((1)) NOT NULL,
    [Description]  NVARCHAR (800) NULL,
    [DeleteMark]   INT            CONSTRAINT [DF_PiStaffOrganize_DeleteMark] DEFAULT ((0)) NOT NULL,
    [CreateOn]     DATETIME       CONSTRAINT [DF__PiStaffOr__Creat__6D0D32F4] DEFAULT (getdate()) NOT NULL,
    [CreateUserId] NVARCHAR (50)  NULL,
    [CreateBy]     NVARCHAR (50)  NULL,
    [ModifiedOn]   DATETIME       NULL,
    [ModifyUserId] NVARCHAR (50)  NULL,
    [ModifiedBy]   NVARCHAR (50)  NULL,
    CONSTRAINT [PK_PISTAFFORGANIZE] PRIMARY KEY NONCLUSTERED ([Id] ASC),
    CONSTRAINT [FK_StaffOrganize_OrganizeId] FOREIGN KEY ([OrganizeId]) REFERENCES [dbo].[PiOrganize] ([Id]),
    CONSTRAINT [FK_StaffOrganize_StaffId] FOREIGN KEY ([StaffId]) REFERENCES [dbo].[PiStaff] ([Id])
);

